package com.training.java.core.collections.car.post15;

import java.util.HashSet;
import java.util.Set;
import java.util.TreeSet;

/**
 * The purpose of this demo is to observe collections TreeSet. Should not take
 * nulls,duplicates. Should give the list in alphabetical order.
 * 
 * @author Satya
 * 
 */
public class StringTreeSetDemo {

	public static void main(String[] args) {

		// Create TreeSet
		Set<String> names = new TreeSet<String>();

		// Adding String Objects to set

		names.add("Satya");
		names.add("Reenu");
		names.add("Susmitha");
		names.add("Siva");
		names.add("Raji");
		names.add("Meera");
		names.add("Chandana");
		names.add("Lasya");
		names.add("Abhi");
		names.add("Abhi");// trying to add duplicate string,should not take
							// duplicates
		names.add("abhi");// adding lower case letters, Should display last in
							// the list
		// names.add(null);//adding null values,Null pointer exception should
		// raise.

		for (String name : names) {

			System.out.println("Student name :  " + name);
		}
	}

}
